﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">

        window.onerror = function () {
            return true;
        };
    </script>
    <script src="../Scripts/jquery.js" type="text/javascript"></script>
    <link href="../Styles/ts_css.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            var winHeight = $(document.body).outerHeight(true);
            $("#hidWinHeight").val(winHeight);
            //            alert($(window).height()); //浏览器当前窗口可视区域高度 
            //            alert($(document).height()); //浏览器当前窗口文档的高度 
            //            alert($(document.body).height()); //浏览器当前窗口文档body的高度 
            //            alert($(document.body).outerHeight(true)); //浏览器当前窗口文档body的总高度 包括border padding margin 

        });
    
    </script>
    <style type="text/css">
    /* 列表样式2 * START --------------------*/
    table.tablist
    {
        width: 100%;
        font-size: 12px;
        margin: 0 auto;
        color: #515151;
        text-align: center;
        border-collapse: collapse; /*细线表格代码*/
    }
    table.tablist td
    {
        border: 1px solid #82AFE8; /*细线表格线条颜色*/
        height: 23px;
    }
    table.tablist tr.t1 td
    {
        background-color: #fff;
    }
    /* 交替行第一行的背景色 */
    table.tablist tr.t2 td
    {
        background-color: #EDEDED;
    }
    /* 交替行第二行的背景色 */
    table.tablist tr.t3 td
    {
        background-color: #BDDBFF;
    }
    /* 鼠标经过时的背景色 */
    table.tablist th
    {
        line-height: 23px;
        border: 1px solid #82AFE8;
        background: url(../images/table_dataList.gif) left center repeat-x;
        color: #005B7C;
    }
    table.tablist tbody tr td
    {
        text-align: center;
        white-space: nowrap;
    }
    
    
    /* 列表样式2 *END ---------------------*/
</style>
</head>
<body>
<div class="fjlb">
    <div class="fjlb_1">
        <div class="fjlb_1_font">
            附件列表</div>
        <div class="fjlb_1_jt" id="testtab">
            <a href="#" onclick="Effect('test',this.parentNode.id);">
                <img src="../images/jt1_t.png" id="imgJtd" alt="" /></a></div>
    </div>
    <div class="fjlb_2" id="divTj">
        <table class="tablist">
            <thead>
                <tr>
                    <th class="style1">
                        附件名称
                    </th>
                    <th width="14%">
                        删除
                    </th>
                    <th width="14%">
                        下载
                    </th>
                    <th width="43%">
                        说明
                    </th>
                </tr>
            </thead>
            <tbody id="listHeader">
                <asp:Repeater ID="uploadFileList" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td>
                                <asp:Label ID="lblAttachmentName" runat="server" Text='<%#  HtmlEncode(Eval("AttachmentName"))%>'></asp:Label>
                            </td>
                            <td>
                                <asp:LinkButton ID="lkbDel" runat="server" OnClick="lkbDel_Click" CssClass='<%# DataBinder.Eval(Container.DataItem, "AttachmentId") %>'
                                    Text="删除" OnClientClick="return confirm('是否确认删除？')"></asp:LinkButton>
                            </td>
                            <td>
                                <asp:LinkButton ID="lkbDown" OnClick="lkbDown_Click" runat="server" CssClass='<%# DataBinder.Eval(Container.DataItem, "AttachmentId") %>'
                                    Text="下载"></asp:LinkButton>
                            </td>
                            <td>
                                <asp:Label ID="lblAttachmentContent" runat="server" Text='<%#  SubStrData(HtmlEncode(Eval("AttachmentContent")),15)%>'
                                    ToolTip='<%# DataBinder.Eval(Container.DataItem, "AttachmentContent") %>'></asp:Label>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
        </table>
        <div class="add">
            新增 <span id='uploadSpan'>
                <asp:FileUpload ID="uploadFile" runat="server" onpropertychange="return IsCheckType(this);" />
            </span>附件说明:<asp:TextBox ID="txtAttachmentContent" runat="server" MaxLength="50"></asp:TextBox>
            <asp:Button ID="btnSubMit" runat="server" Text="上传" OnClick="btnSubMit_Click" OnClientClick=" parent.showLoading();" />
            提示：附件限10M以下(建议格式为jpg、pdf)
        </div>
        <asp:HiddenField ID="hidIspostBack" runat="server" Value="0" ClientIDMode="Static" />
    </div>
</div>
<script language="JavaScript" type="text/JavaScript">

    function IsCheckType(files) {
        var myReg = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.exe|.EXE|.sql|.cs|.cdm|.aspx|.dll|.msi|.bat|.Bat|.BAT)$/;
        var html = document.getElementById('uploadSpan').innerHTML;
        if (myReg.test(files.value)) {
            if (files.value != '') {
                alert("不能上传非法文件");
                document.getElementById('uploadSpan').innerHTML = html;
                return false;
            }
        }
        else {

            return true;
        }
    }
    $(function () {

        $("#imgJtd").toggle(function () {
            this.src = "../images/jt1_d.png";
            $("#divTj").slideToggle("show(500)", function () {
               // parent.setIframeHeight($("#hidWinHeight").val());
            })
        }, function () {
            $("#divTj").slideToggle("hide(500)");
            this.src = "../images/jt1_t.png";
        });
        setTrCss();

    });




    function setTrCss() {
        var Ptr = document.getElementById("listHeader").getElementsByTagName("tr");
        for (i = 1; i < Ptr.length + 1; i++) {
            Ptr[i - 1].className = (i % 2 > 0) ? "t1" : "t2";
        }
        for (var i = 0; i < Ptr.length; i++) {
            Ptr[i].onmouseover = function () {
                this.tmpClass = this.className;
                this.className = "t3";
            };
            Ptr[i].onmouseout = function () {
                this.className = this.tmpClass;
            };
        }
    }

    function iFrameHeight() {
        var ifm = document.getElementById("fileUpLoadIframe");
        var subWeb = document.frames ? document.frames["fileUpLoadIframe"].document : ifm.contentDocument;
        if (ifm != null && subWeb != null) {
            ifm.height = subWeb.body.scrollHeight + 100;
        }
    } 
</script>
</body>
</html>
